package com.vv.controller;

import com.vv.bean.Order;
import com.vv.bean.Product;
import com.vv.bean.Vo.CartVo;
import com.vv.bean.Vo.OrderVo;
import com.vv.dao.ProductMapper;
import com.vv.service.OrderService;
import com.vv.service.ProductService;
import com.vv.util.MyUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

@Controller
public class testController {
    @Autowired
    private ProductService productService;
    @Autowired
    private OrderService orderService;
    @Autowired
    ProductMapper productMapper;

    @RequestMapping("test")
    @ResponseBody
    public List<Product> test(){
        List<Product> products = productService.getProducts();
        return products;
    }

    @RequestMapping(value = "getProductById",method = RequestMethod.GET)
    @ResponseBody
    public Product getProductById(Long pid){
        System.out.println(pid);
        return productService.getProductByPid(pid);
    }

    @RequestMapping("getCartList")
    public List<CartVo> getCartList(Long userid){
        return null;
    }

    @RequestMapping("addCart")
    public void addCart(Long userId,Long pid,int pcount){

    }
}
